package com.mojiayi.learn.common.result;

import java.io.Serializable;

/**
 * 结果集基类.
 *
 * @param <T> 返回对象
 */
public class BaseResultSet<T> implements Serializable {
    private static final long serialVersionUID = 1L;
    /** 返回结果是否正确. **/
    private boolean isSucess = true;
    /** 异常设置. **/
    private Throwable exception;

    /** 错误代码. **/
    private String errCode = "0";

    /** 错误描述. **/
    private String errMsg;

    /**
     * 返回是否成功.
     * 
     * @return boolean
     */
    public boolean isSucess() {
        return isSucess;
    }

    /**
     * 设置为成功.
     */
    public void updateSucess() {
        this.isSucess = true;
    }

    /**
     * 更新错误信息.
     * 
     * @param errCode 错误码
     * @param errMsg 错误消息
     */
    public void updateFailure(String errCode, String errMsg) {
        this.isSucess = false;
        this.errCode = errCode;
        this.errMsg = errMsg;
    }

    public String getErrCode() {
        return this.errCode;
    }

    public String getErrMsg() {
        return this.errMsg;
    }

    public Throwable getException() {
        return exception;
    }

    public void setException(Throwable exception) {
        this.exception = exception;
    }

}